Redact admin passwords from default studio list JSON - #4730
Conversation
Keep inventory machine output non-secret and send credential retrieval through `studio config get admin-password`.
📊 Performance Test ResultsComparing 6dfdc00 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
|
Hi @chubes4 ! I merged trunk in, confirmed build works fine, and tested it. The main fix is correct and I verified it works. Would you mind checking those?
Studio's built-in AI assistant reads that same output. So it lost access to passwords too. That's fine on its own — but three places in the code still tell the assistant "this command gives you credentials." So if you ask it "what's my admin password?", it confidently runs the command, gets nothing, and either gives up or makes one up. Worse: there's no backup route. The PR says "use studio config get admin-password instead," but the assistant has no such tool. It's a dead end. Fix: edit those three sentences to stop promising credentials.
Fix: either patch that command too, or correct the sentence.
The code removes three fields by name. The PR describes this as removing "any extra secret fields" — it doesn't. If someone adds a new secret field later, it gets printed until a person remembers to add it to the list. Safer approach: instead of listing what to hide, list what to show. Then anything new is hidden by default. Minor: two of the three names on the list (tlsKey, tlsCert) aren't stored in this file at all, so they never do anything. Harmless, just noise.
|
Closes #4729.
Summary
studio list --format=jsonno longer emitsadminPassword, TLS material, or other secret fields on stdout.studio status --format=jsonis audited the same way and no longer emitsadminPassword.studio config get admin-password. Do not log that value.listSites()still receives the full record so GUI credential flows are unchanged.Root cause
studio list --format=jsonserialized each site with...site, so the entire stored site record — including encodedadminPasswordand any extra secret fields — was dumped to stdout. Table output never showed passwords, so JSON had a surprising secret surface.Verification
npx vitest run apps/cli/commands/site/tests/list.test.ts apps/cli/commands/site/tests/status.test.ts apps/cli/lib/tests/site-secret-fields.test.ts(19 passed)npx eslinton the changed CLI files (no findings)AI assistance
OpenAI gpt-5.6-sol via OpenCode general coding subagent inspected the CLI list/status serializers, implemented the redaction, added contract tests, and opened this PR. Chris Huber directed the work and remains responsible for the change.